<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response; 
function addRoute($app){ 
	$app->get('/hello/{name}', function (Request $request, Response $response, array $args) {  
		$name = $args['name'];
		$response->getBody()->write("Hello, $name");

		return $response;
	});
	$app->get('/', function (Request $request, Response $response, array $args) { 
		echo 'welcome this dispatch!';
		return $response;
	});  
	$mw = function ($request, $response, $next) {
		$response->getBody()->write('BEFORE');
		$response = $next($request, $response);
		$response->getBody()->write('AFTER');
	
		return $response;
	};

	$app->post('/api/forleave', \App\controller\opController::class . ':forleave'); 
	$app->post('/api/forfix', \App\controller\opController::class . ':forfix'); 
	$app->post('/api/fordispatch', \App\controller\opController::class . ':fordispatch'); 
	$app->post('/api/outdoor', \App\controller\opController::class . ':outdoor'); 
	$app->post('/api/indoor', \App\controller\opController::class . ':indoor'); 
	$app->post('/api/cancelorder', \App\controller\opController::class . ':cancelorder'); 
	$app->get('/api/driverlist', \App\controller\opController::class . ':driverlist');
	$app->get('/api/initday', \App\controller\opController::class . ':initday');
	
} 
